<div ng-controller="StoredistributionCtrl" ng-init="loglistAction()">
    <ul class="sui-breadcrumb">
        <li>{{'分账日志'|translate}}</li>
        <li>列表
        </li>
    </ul>
    <fz-log-tab ng-model="chosedStatus" click-tab="getfzlog(1)"></fz-log-tab>

    <span ng-show="chosedStatus == 1">
        <fz-log-type-tab ng-model="chosedOrderType" click-tab="getfzlog(1)"></fz-log-type-tab>
        <!-- <span ng-show="chosedOrderType == 1"> -->
            <settlement-tab ng-model="chosedOrderStatus" click-tab="getfzlog(1)"></settlement-tab>
        <!-- </span> -->
    </span>
    <table class="sui-table table-bordered" ng-if="chosedStatus == 1" ng-repeat="(key, list) in List">
        <thead>
        <tr>
            <th colspan="11">
                <label class="checkbox pull-left">
                    订单编号：{{key}};
                    <order-dd-status ng-model="key"></order-dd-status>
                </label>
                <span class="pull-right">
                    <button class="sui-btn btn-info" ng-show="list.order_status == 1 && list.fz_state == 1"
                            ng-click="fzFinish(key)">{{'完结分账'|translate}}</button>
                    <order-hg-status order-id="key"></order-hg-status>
                </span>
            </th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <th>{{'店铺'|translate}}</th>
            <th>{{'订单号'|translate}}</th>
            <th>{{'分账流水号'|translate}}</th>
            <th>{{'账号'|translate}}</th>
            <th>{{'分账金额'|translate}}</th>
            <th>{{'分账类型'|translate}}</th>
            <th>{{'状态'|translate}}</th>
            <th>{{'created_at'|translate}}</th>
            <th>{{'分账时间'|translate}}</th>
            <th>{{'日志'|translate}}</th>
            <th>{{'操作'|translate}}</th>
        </tr>
        <tr ng-repeat="list1 in list.log_list">
            <td>
                <store-list ng-model="list1.store_id" stype="1" cache="1">
                </store-list>
            </td>
            <td>
                {{list1.order_id}}

            </td>
            <td>
                {{list1.fz_order_id}}
            </td>
            <td>
                {{list1.name}}
            </td>
            <td>
                {{list1.paymoney}}
            </td>
            <td>
                <span ng-show="list1.type ==1">微信</span>
                <span ng-show="list1.type ==2">银联</span>
            </td>
            <td>
                <span ng-show="list1.state == 1" class="sui-text-info">未分账</span>
                <span ng-show="list1.state == 2" class="sui-text-success">分账完成</span>
                <span ng-show="list1.state == 3" class="sui-text-success">分账失败</span>
                <span ng-show="list1.state == 4" class="sui-text-success">分账已完结</span>
            </td>
            <td>{{list1.created_time}}</td>
            <td>{{list1.fz_time}}</td>
            <td>
                {{list1.yl_log}}
            </td>
            <td>
                <button class="sui-btn btn-danger" ng-show="list.order_status == 1 && list1.state == 1"
                        ng-click="implement(list1.fz_log_id,key)">{{'确认分账'|translate}}
                </button>
                <button class="sui-btn btn-danger" ng-show="list.order_status == 1 && list1.state == 3"
                        ng-click="implement(list1.fz_log_id,key)">{{'重新分账'|translate}}
                </button>
            </td>
        </tr>
        </tbody>
    </table>
    <table class="sui-table table-bordered" ng-if="chosedStatus == 2">
        <thead>
        <tr>
            <th>{{'店铺'|translate}}</th>
            <th>{{'订单号'|translate}}</th>
            <th>{{'分账流水号'|translate}}</th>
            <th>{{'账号'|translate}}</th>
            <th>{{'分账金额'|translate}}</th>
            <th>{{'分账类型'|translate}}</th>
            <!-- <th>{{'状态'|translate}}</th> -->
            <th>{{'created_at'|translate}}</th>
            <th>{{'分账时间'|translate}}</th>
            <th>{{'日志'|translate}}</th>
            <th>{{'操作'|translate}}</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="list in List">
            <td>
                <store-list ng-model="list.store_id" stype="1" cache="1">
                </store-list>
            </td>
            <td>
                {{list.order_id}}
                <div class="msg-con">
                    <order-dd-status ng-model="list.order_id"></order-dd-status>
                </div>
                <s class="msg-icon"></s>
                <br>
                <order-hg-status order-id="list.order_id"></order-hg-status>
            </td>
            <td>
                {{list.fz_order_id}}
            </td>
            <td>
                {{list.name}}
            </td>
            <td>
                {{list.paymoney}}
            </td>
            <!--  <td>
                <span ng-show="list.type ==1">微信</span>
                <span ng-show="list.type ==2">银联</span>
            </td> -->
            <td>
                <span ng-show="list.state ==1" class="sui-text-info">未分账</span>
                <span ng-show="list.state ==2" class="sui-text-success">分账完成</span>
                <span ng-show="list.state ==3" class="sui-text-success">分账失败</span>
                <span ng-show="list.state ==4" class="sui-text-success">分账已完结</span>
            </td>
            <td>
                {{list.created_time | ddtt}}
            </td>
            <td>{{list.fz_time | ddtt}}</td>
            <td>
                {{list.yl_log}}
            </td>
            <td>
                <button class="sui-btn btn-danger" ng-show="list.state ==1" ng-click="implement(list.fz_log_id)">
                    {{'确认分账'|translate}}
                </button>
                <button class="sui-btn btn-danger" ng-show="list.state ==3" ng-click="implement(list.fz_log_id)">
                    {{'重新分账'|translate}}
                </button>
                <span ng-show="list.type ==2">
                        <button class="sui-btn btn-success"
                                ng-click="getFz(list.fz_log_id,1)">{{'备用金查询'|translate}}</button>
                        <button class="sui-btn btn-warning"
                                ng-click="getFz(list.fz_log_id,2)">{{'分账状态查询'|translate}}</button>
                    </span>
            </td>
        </tr>
        </tbody>
    </table>
    <pager ng-if="chosedStatus == 1 || chosedStatus == 2" page-no="1" page-size="page_size1" total="storeTotal" get-data="getfzlog(pageNo)"></pager>
    <div ng-if="chosedStatus == 3">
        <table class="sui-table table-bordered">
            <thead>
            <tr>
                <th>{{'店铺'|translate}}</th>
                <th>{{'订单号'|translate}}</th>
                <th>{{'顾客'|translate}}</th>
                <th>{{'支付金额'|translate}}</th>
                <th>{{'created_at'|translate}}</th>
                <th>{{'操作'|translate}}</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="list in freeze_log_list">
                <td>
                    <store-list ng-model="list.store_id" stype="1" cache="1">
                    </store-list>
                </td>
                <td>
                    {{list.order_id}}
                    <div class="msg-con">
                        <order-dd-status ng-model="list.order_id"></order-dd-status>
                    </div>
                    <s class="msg-icon"></s>
                </td>
                <td>
                    <wxinfo ng-model="list.member_id" stye="1" is-url="1"></wxinfo>
                </td>
                <td>
                    {{list.payment}}
                </td>
                <td>
                    {{list.created_at}}
                </td>
                <td>
                    <button class="sui-btn btn-info" ng-click="fzFinish(list.order_id)">{{'解冻资金'|translate}}</button>
                </td>
            </tr>
            </tbody>
        </table>
        <pager ng-if="chosedStatus == 3" page-no="1" page-size="page_size1" total="freeze_count"
               get-data="getfzlog(pageNo)"></pager>
    </div>
    <table class="sui-table table-bordered" ng-if="chosedStatus == 4">
        <thead>
        <tr>
            <th>{{'店铺'|translate}}</th>
            <th>{{'订单号'|translate}}</th>
            <th>{{'分账流水号'|translate}}</th>
            <th>{{'账号'|translate}}</th>
            <th>{{'分账金额'|translate}}</th>
            <th>{{'分账类型'|translate}}</th>
            <!-- <th>{{'状态'|translate}}</th> -->
            <th>{{'created_at'|translate}}</th>
            <th>{{'分账时间'|translate}}</th>
            <th>{{'日志'|translate}}</th>
            <th>{{'操作'|translate}}</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="list in List">
            <td>
                <store-list ng-model="list.store_id" stype="1" cache="1">
                </store-list>
            </td>
            <td>
                {{list.order_id}}
                <div class="msg-con">
                    <order-dd-status ng-model="list.order_id"></order-dd-status>
                </div>
                <s class="msg-icon"></s>
                <br>
                <order-hg-status order-id="list.order_id"></order-hg-status>
            </td>
            <td>
                {{list.fz_order_id}}
            </td>
            <td>
                {{list.name}}
            </td>
            <td>
                {{list.paymoney}}
            </td>
            <!--  <td>
                <span ng-show="list.type ==1">微信</span>
                <span ng-show="list.type ==2">银联</span>
            </td> -->
            <td>
                <span ng-show="list.state ==1" class="sui-text-info">未分账</span>
                <span ng-show="list.state ==2" class="sui-text-success">分账完成(待结算)</span>
                <span ng-show="list.state ==3" class="sui-text-success">分账失败</span>
                <span ng-show="list.state ==4" class="sui-text-success">分账已完结</span>
            </td>
            <td>
                {{list.created_time | ddtt}}
            </td>
            <td>{{list.fz_time | ddtt}}</td>
            <td>
                {{list.yl_log}}
            </td>
            <td>
                <button class="sui-btn btn-danger" ng-show="list.state ==1" ng-click="implement(list.fz_log_id)">{{'确认分账'|translate}}</button>
                <button class="sui-btn btn-danger" ng-show="list.state ==3" ng-click="implement(list.fz_log_id)">{{'重新分账'|translate}}</button>
                <button class="sui-btn btn-danger" ng-show="list.state ==2 && chosedStatus==4" ng-click="NewPaySeparate(list.fz_log_id)">{{'分账结算'|translate}}</button>
            </td>
        </tr>
        </tbody>
    </table>
    <pager ng-if="chosedStatus == 4" page-no="1" page-size="page_size1" total="storeTotal" get-data="getfzlog(pageNo)"></pager>
</div>
